<?php
// +----------------------------------------------------------------------
// | Copyright © Sogu Technologies Co. Ltd 2018-2050 All rights reserved.
// +----------------------------------------------------------------------
// | File name: VerifyPhoneRequest.php
// +----------------------------------------------------------------------
// | Author: liuju
// +----------------------------------------------------------------------
// | Description: 修改密码时验证手机的验证码
// +----------------------------------------------------------------------
// | Others: 其他内容的说明
// +----------------------------------------------------------------------
// | History: 修改历史记录列表，每条修改记录应包含修改日期、修改者及修改内容简述
// +----------------------------------------------------------------------
// | 1.Date: 2018-12-27 Author: liuju Modification: 创建
// +----------------------------------------------------------------------

namespace App\Http\Requests\Frontend\V10\Users;

use App\Rules\MobileCheck;
use Illuminate\Foundation\Http\FormRequest;

class VerifyPhoneRequest extends FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'phone_num' => ['bail', 'required', new MobileCheck],
            'captcha' => 'bail|required',
            'key' => 'required',
            'sms_code' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'phone_num.required' => '手机号码不能为空',
            'phone_num.unique' => '该手机号已存在',
            'captcha.required' => '缺少图片验证码',
            'key.required' => '缺少关键信息',
            'code.captcha_api' => '图形验证码不正确',
            'sms_code.required' => '缺少短信验证码',
        ];
    }

}